<?xml version="1.0" encoding="UTF-8" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">


<h:body>
	<ui:composition template="../templates/general.xhtml">
		<ui:define name="content">
      		
      		<f:metadata>
        		<f:viewParam id="mode" name="mode" value="#{configBean.mode}"/>	
			</f:metadata>
      		
      		<f:event type="preRenderView" listener="#{configBean.init}" />
      		
      		<h1 class="page-header">
				<i class="fa fa-gear fa-3"></i> Configurações
			</h1>
      			
      		<p:growl id="messages" showDetail="true" autoUpdate="true"/>
      			
      		<p:tabView orientation="left">
      			<p:tab title="Aplicação">
      				<h3 class="page-header" style="margin-top:0px;">
						<i class="fa fa-gear fa-3"></i> Ano Lectivo
					</h3>
					
					<h:panelGrid columns="4" >  
      					<p:panel styleClass="jumbotron">
      						<h:panelGrid columns="2" columnClasses="first,second" >
      							<h:outputLabel for="anoActual" value="Actual:" style="font-size: 0.9em;" />
            					<p:inputText id="anoActual" value="#{configBean.anoLectivo}" disabled="true" style="width:330px; font-size: 0.9em;" />
            		
            					<p:commandButton id="btnMudarAno" value="Mudar de Ano" action="#{configBean.mudarAno}" style="font-size: 0.9em;" ajax="false" >
            						<p:confirm header="Confirmação"
										message="Tem a certeza que pretende mudar de ano? Esta acção fará com que todos os grupos e alunos seja arquivados e desassociados do github."
										icon="ui-icon-alert" />
            					</p:commandButton>
            					
  							</h:panelGrid>
      					</p:panel>
      				</h:panelGrid>	
      			</p:tab>
      			<p:tab title="Email">
      			
      			<h:panelGrid columns="4" >  
      					<p:panel styleClass="jumbotron">
      						<h:panelGrid columns="4" columnClasses="first,second" >
      							<h:outputLabel for="endereco" value="Endereço:" style="font-size: 0.9em;" />
            					<p:inputText id="endereco" value="#{configBean.endereco}" required="true" style="width:330px; font-size: 0.9em;" disabled="#{configBean.disableComponent}"/>
            		
            					<h:outputLabel for="smtpHost" value="SMPT Host:" style="font-size: 0.9em;" />
            					<p:inputText id="smtpHost" value="#{configBean.smtpHost}" required="true" disabled="#{configBean.disableComponent}" style="font-size: 0.9em;" />

								<h:outputLabel for="password" value="Password:" style="font-size: 0.9em;" />
            					<p:inputText id="password" type="password" value="#{configBean.password}" required="true" disabled="#{configBean.disableComponent}" style="font-size: 0.9em;"  />

								<h:outputLabel for="smtpPort" value="SMPT Port:" style="font-size: 0.9em;" />
            					<p:inputText id="smtpPort" value="#{configBean.smtpPort}" required="true" disabled="#{configBean.disableComponent}" style="font-size: 0.9em;" />

  							</h:panelGrid>
            			</p:panel>
      			</h:panelGrid>		
      			</p:tab>
      			<p:tab title="Github">
      				<h:panelGrid columns="4" >  
      					<p:panel styleClass="jumbotron">
      						<h:panelGrid columns="2" columnClasses="first,second" >
      							<h:outputLabel for="organization" value="Nome Organização:" style="font-size: 0.9em;" />
            					<p:inputText id="organization" value="#{configBean.organizacao}" required="true" style="width:330px; font-size: 0.9em;" disabled="#{configBean.disableComponent}"/>
            		
            					<h:outputLabel for="userName" value="Username:" style="font-size: 0.9em;" />
            					<p:inputText id="userName" value="#{configBean.usernameGit}" required="true" disabled="#{configBean.disableComponent}" style="font-size: 0.9em;" />

								<h:outputLabel for="passwordGit" value="Password:" style="font-size: 0.9em;" />
            					<p:inputText id="passwordGit" type="password" value="#{configBean.passwordGit}" required="true" disabled="#{configBean.disableComponent}" style="font-size: 0.9em;"  />

  							</h:panelGrid>
            			</p:panel>
      				</h:panelGrid>
      			</p:tab>
      		</p:tabView>
      		
      		<h3 class="page-header"></h3>
            			
            <p:commandButton id="editar" value="Editar" action="#{configBean.editar}" ajax="false" rendered="#{configBean.renderBotaoEditar}" style="margin-right: 10px; margin-bottom: 50px; float:right; font-size: 0.9em;" />
            <p:commandButton id="gravar" value="Gravar" action="#{configBean.gravar}" ajax="false" rendered="#{configBean.renderBotaoGravar}" style="margin-right: 10px; margin-bottom: 50px; float:right; font-size: 0.9em;" />
    	
    		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
				<p:commandButton value="Sim" type="button"
					styleClass="ui-confirmdialog-yes" icon="ui-icon-check"
					style="font-size: 0.9em;" />
				<p:commandButton value="Não" type="button"
					styleClass="ui-confirmdialog-no" icon="ui-icon-close"
					style="font-size: 0.9em;" />
			</p:confirmDialog>
    	</ui:define>
	</ui:composition>
</h:body>
</html>